<?php /* Template Name: Galeria */ ?>


<style type="text/css">
.cont-topo       {width: 980px; background-color: #ffffff; display: table; }
.bar-page 	     {width: 950px; height: 65px; margin: 0 10px 0 20px;}
</style>


<?php get_header(); ?>
<body>

<div id="tudo">

<div id="topo"><?php include_once MODULOS.'/topo.php'; ?></div><!-- Fim div topo -->
<?php do_vertical_space('20'); ?>

<div id="corpo">
<?php do_vertical_space('15'); ?>
<div class="breadcrumb" style="margin-left: 20px;"><?php the_breadcrumb(); ?></div>
<?php do_vertical_space('10'); ?>	

	<div class="cont-topo">		
		<div class="bar-page" style="border-bottom: 2px #efefef solid;"><?php conteudo_barra_page ('Link direto:&nbsp;'); ?></div>
		<?php do_vertical_space('20'); ?>		
		<div class="bar-page"><?php titulo_barra_page ('Aves PT', 'Galeria de Fotos'); ?></div>
		<?php do_vertical_space('20'); ?>
	</div><!-- Fim div conteiner-topo -->
	
	<div id="miolo">		
		<?php do_vertical_space('15'); 
		//Acessa galeria
		include_once TEMPLATEPATH.'/av-define.php';
		include_once PDO.'/NextGenPDO.class.php';
		$ngg_obj = new NextGenPDO ();
		?>
		

		<!--
		Galeria de fotos (Mostra a galeria Principal)
		-->
		<?php
		if (isset($_GET["id"])) {$gal_id = $_GET["id"];} else {$gal_id = $ngg_obj->galeria_get_last_gid();} 
		nggShowSlideshow($gal_id, 630, 450); 
		?>
		<p>Legenda da Galeria</p>
		<!--
		Galeria de fotos (Mostra a galeria Principal)
		-->

		<!--
		Galeria de fotos (Mostra lista de galerias)
		-->
		<div id="cont-lista-galeria" style="width: 630px; height: auto; display: table;">
			<?php
			$galeria_tudo = $ngg_obj->galeria_get_all();
			$galeria_picture_tudo = $ngg_obj->galeria_get_picture_source();
			$aux_id = 0;

			foreach ($galeria_picture_tudo as $key => $value) { 
				$aux_id = $aux_id + 1;
				if ( $aux_id == 1 ) {
					$galeria_id  = $value['gid'];
					$verificacao = $value['gid'];
					$galeria_info [] = $value;					
				} 
				$verificacao = $value['gid'];
				if ( $galeria_id != $verificacao ) {
					$aux_id = 0;
				}
			}
  						
			$aux = 0;
			$margin = '0 15px 0 0';
			foreach ($galeria_picture_tudo as $key => $value) { 
				$aux = $aux + 1;
				if ( $aux > 3) {break;}
				if ( $aux == 3 ) {$margin = 0;}
				if ( $aux == 1 ) { ?> 
				<div id="cont-linha-lista-galeria" style="margin: 0;"> <?php } ?>				
					<div class="cont-thumb-galeria" style="width: 200px; height: 142px; background-color: #f2f2f2; float: left; margin: <?php echo $margin;?>;" >
						<a href="?id=<?php echo $galeria_info[$aux-1]['gid']; ?>">
							<img src="<?php echo get_bloginfo( 'url' ).'/'.$galeria_info[$aux-1]['path'].'/'.$galeria_info[$aux-1]['filename'];?>" width="200px" height="142px" />
						</a>
						<?php do_vertical_space (5); ?>
						<div style="width: 200px; height: 60px; float: left; margin: <?php echo $margin;?>;" ><?php echo $galeria_info[$aux-1]['name'] ?></div>									
					</div>

					<?php if ( $aux == 3 ) {$margin = '0 15px 0 0';?>					
				</div><!-- Fecha cont-linha-lista-galeria -->
				<div class="clr"></div>
				<?php do_vertical_space('30'); }
			}	
			?>
		</div><!-- Fecha cont-lista-galeria -->
		
		<!--
		Galeria de fotos (Mostra lista de galerias)
		-->
	</div><!-- Fim div miolo -->

	<div id="direita">
		<?php dynamic_sidebar( 'Lateral Direita Home' ); ?>
		<?php do_vertical_space('20');?>
	</div><!-- Fim div coluna_direita -->
	
</div><!-- Fim div corpo -->
<?php do_vertical_space('20'); ?>	

<div class="cont-miolo-pub"><?php add_google_pub_bloco_2x468x60 (); ?></div>
<?php do_vertical_space('20'); ?>		

</div><!-- Fim div tudo -->
<?php get_footer(); ?>

</body>

</html>